<!DOCTYPE html>
<html lang="{{ .Site.Language.Lang }}" dir={{ .Site.Language.LanguageDirection }}>

<head>
  {{ partial "docs/html-head" . }}
  {{ partial "docs/inject/head" . }}
</head>

<body dir={{ .Site.Language.LanguageDirection }}>
  <input type="checkbox" class="hidden toggle" id="menu-control" />
  <input type="checkbox" class="toggle" id="search-control" />
  <main class="container flex">
    <label for="menu-control" class="hidden book-overlay book-menu-overlay"></label>
    <label for="search-control" class="hidden book-overlay book-search-overlay"></label>
    <div class="hidden book-zoom-container"></div>
    <header class="book-header">
      {{ template "header" . }}
      <!-- Mobile layout header -->
    </header>

    <div class="book-main flex">
      <aside class="book-menu">
        {{ template "menu" . }}
        <!-- Left menu Content -->
      </aside>

      <div class="book-page">
        <div class="book-page-header">
          <div class="book-page-title-container">
            <div class="book-page-title">
              <h1>{{ partial "docs/title" . }}</h1>
            </div>
            {{ if default false (default .Site.Params.BookExportPDF .Params.BookExportPDF) }}
            <label for="pdf-control">
              <span class="book-icon-wrapper">
                {{partial "svgs/pdf.svg" .}}
              </span>
            </label>
            {{ end }}
            <label for="toc-control">
              {{ if default true (default .Site.Params.BookToC .Params.BookToC) }}
              <span class="book-icon-wrapper">
                {{partial "svgs/toc.svg" .}}
              </span>
              {{ end }}
            </label>
            {{ if default true (default .Site.Params.BookToC .Params.BookToC) }}
            <div id="tocPopover" class="hidden clearfix">
              <div class="book-popover-toc">
                <div class="book-popover-toc-inner">
                  {{ template "toc" . }}
                </div>
              </div>
            </div>
            {{ end }}
            {{ if default false (default .Site.Params.BookExportPDF .Params.BookExportPDF) }}
              <div id="exportPDFPopover" class="hidden clearfix">
                {{ template "pdf-export-links" .}}
              </div>
            {{ end }}
          </div>
          <div class="book-page-description">
            {{ .Description }}
          </div>
        </div>
        {{ partial "docs/inject/content-before" . }}

        {{ template "main" . }}
        <!-- Page Content -->
        {{ partial "docs/inject/content-after" . }}

        <footer class="book-footer">
          {{ partial "docs/pagination.html" .}}
          {{ template "footer" . }}
          <!-- Footer under page content -->
          {{ partial "docs/inject/footer" . }}
        </footer>

        {{ template "comments" . }}
        <!-- Comments block -->
      </div>

      <aside class="book-page-aside">
        <div class="book-page-aside-inner">
          {{ if default false (default .Site.Params.BookExportPDF .Params.BookExportPDF) }}
          <div class="book-topdf">
            <label for="pdf-control">
              <div class="book-topdf-header">
                <span class="book-icon-wrapper">
                  {{partial "svgs/pdf.svg" .}}
                </span>
                <span class="book-toc-text">
                  {{ i18n "Topdf"}}
                </span>
              </div>
            </label>
          </div>
          {{ end }}
          {{ if default true (default .Site.Params.BookToC .Params.BookToC) }}
          <div class="book-toc">
            {{ template "toc" . }}
          </div>
          {{ end }}
          <!-- Table of Contents -->
        </div>
      </aside>

    </div>
    {{ partial "docs/search" . }}
  </main>
  {{ partial "docs/html-footer" . }}
  {{ partial "docs/inject/body" . }}
</body>

</html>

{{ define "menu" }}
{{ partial "docs/menu" . }}
{{ end }}

{{ define "header" }}
{{ partial "docs/header" . }}

{{ end }}

{{ define "footer" }}
{{ partial "docs/footer" . }}
{{ end }}

{{ define "comments" }}
{{ if and .Content (default true (default .Site.Params.BookComments .Params.BookComments)) }}
<div class="book-comments">
  {{- partial "docs/comments" . -}}
</div>
{{ end }}
{{ end }}
{{ define "pdf-export-links" }}
<div class="book-topdf-popover">
  <div class="book-topdf-popover-inner">
    <div class="book-topdf-header">
      <span class="book-icon-wrapper">
        {{partial "svgs/toc.svg" .}}
      </span>
      <span class="book-toc-text">
        {{ i18n "Topdf"}}
      </span>
    </div>
    <ul class="book-pdf-exports">
      <li>
        <a href="">{{ i18n "ExportSpace" }}</a>
      </li>
      <li>
        <a href="">{{ i18n "ExportPage" }}</a>
      </li>
    </ul>
  </div>
</div>
{{ end }}


{{ define "main" }}
<article class="markdown">
  {{ if .Content }}
    {{ .Content }}
  {{ else }}
    {{ partial "docs/blank-list.html" .}}
  {{ end }}
</article>
{{ end }}

{{ define "toc" }}
<div class="book-toc-header">
  <span class="book-icon-wrapper">
    {{partial "svgs/toc.svg" .}}
  </span>
  <span class="book-toc-text">
    {{ i18n "Toc"}}
  </span>
</div>
{{ partial "docs/toc" . }}
{{ end }}